package com.hfy.admin.controller;

import com.hfy.admin.service.ApplyService;
import com.hfy.model.dto.admin.ApplyMusicListDto;
import com.hfy.model.dto.admin.ApplyMusicianDto;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import result.Result;

/**
 * @ author 韩
 * time: 2024/7/14 15:14
 */

@RestController
@RequestMapping("/apply")
@Tag(name = "管理员处理申请的控制器" ,description = "主要对各种请求进行处理会涉及很多跨模块操作")
public class ApplyController {


    @Autowired
    private ApplyService applyService;


    @PostMapping("/musician")
    @Operation(summary = "音乐人申请",description = "把前端传过来的音乐人信息封装成审批消息进行发送到审核端处理")
    @Parameters({@Parameter(name = "name",description = "歌手名字"),
            @Parameter(name = "avatar",description = "头像文件"),
            @Parameter(name = "type",description = "歌手类型"),
            @Parameter(name = "area",description = "地区"),
            @Parameter(name = "brief",description = "简介"),
    })
    public Result applyMusician(@RequestBody ApplyMusicianDto dto) {
        return applyService.applyMusician(dto);
    }

    @PostMapping("/music")
    @Operation(summary = "音乐包括其所属专辑申请",description = "把前端传过来的音乐人信息封装成审批消息进行发送到审核端处理")
    @Parameters({@Parameter(name = "musicList",description = "歌曲列表"),
            @Parameter(name = "account",description = "音乐人账号"),
            @Parameter(name = "albumId",description = "专辑ID")
    })
    public Result applyMusic(@RequestBody ApplyMusicListDto dto) {
        return applyService.applyMusic(dto);
    }

    @GetMapping("/musician_ok")
    @Operation(summary = "音乐人申请状况",description = "把前端传过来的账号进行音乐人审核状态查询")
    @Parameters({@Parameter(name = "account",description = "账号")
    })
    public Result applyMusicianIsOk(@RequestParam("account") Long account) {
        return applyService.applyMusicianIsOk(account);
    }

    @GetMapping("/album/info")
    @Operation(summary = "执行专辑附属音乐处理逻辑",description = "根据不同参数，也就是处理操作的不同，执行不同逻辑")
    @Parameters({@Parameter(name = "id",description = "申请id")})
    public Result getApplyAlbumInfoById(@RequestParam("id") Integer id) {
        return applyService.getApplyAlbumInfoById(id);
    }


}
